#include "object.cpp"
#include <iostream>

using namespace std;

/*-----------------------------------------------------------//
// OBJECTS.CPP                                               //
//    Contains unique objects derived from object.cpp        //
// Game Functions:                                           //
//    executeStep: executes every frame                      //
// exampleObject Functions:                                  //
//    showValues: Prints position, velocity, net force, endl //
//    showForces: Prints each individual force vector, endl  //
//-----------------------------------------------------------*/

// exampleObject

class exampleObject: public object
{
    public:
        void executeStep();
        void showValues();
        void showForces();
        void addExampleForce();
};

void exampleObject::executeStep()
{
    forces.checkForce();
    // insert refreshing forces here
		// addExampleForce();
    // end refreshing forces block
    forces.updateNetForce();
    showForces();
    updateVelocity();
	
    move();
    cout << x << "," << y << endl;
}

void exampleObject::showValues()
{
    cout << "Position == (" << x << "," << y << ")\n";
    cout << "Velocity == (" << dx << "," << dy << ")\n";
    cout << "Net Force == (" << forces.netForce.x << "," << forces.netForce.y << ")\n\n";
}

void exampleObject::showForces()
{
    for ( unsigned f = 0; f < forces.size(); f ++ )
    {
        cout << "Force " << f << " == (" << forces[f].x << "," << forces[f].y << ")\n";
    }
}

void exampleObject::addExampleForce()
{
    newForceMagDir(1, getDirectionOrigin(), 1, 1); //Second parameter should be getDirectionOrigin()
}

// fixedSpring

class fixedSpring: public object
{
    public:
        fixedSpring() : anchorx(0), anchory(0), sconstant(1) { };
        
        locvar anchorx, anchory, sconstant;
        void executeStep();
        void setAnchorPoint();
};

void fixedSpring::executeStep()
{
    
}

void fixedSpring::setAnchorPoint()
{
    
}
